//
//  HuiViewController.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/3/13.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "HuiViewController.h"

#import "HuiCell.h"
#import "QianYueDeatialsVC.h"
@interface HuiViewController ()<UITableViewDelegate,UITableViewDataSource>
{
     NSMutableArray *_hiuArr;
}
@property(nonatomic,strong)UITableView *tabView;

@end

@implementation HuiViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"按揭未回款";
    _hiuArr = [NSMutableArray arrayWithCapacity:0];
    _hiuArr = [_huiKDic objectForKey:@"data"];
    _tabView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, B_WIDTH, B_HEIGHT) style:UITableViewStylePlain];
    _tabView.delegate = self;
    _tabView.dataSource = self;
    _tabView.rowHeight = 70;
    _tabView.backgroundColor = BgColor;
    _tabView.separatorStyle = UITableViewCellSelectionStyleNone;//去掉cell的分割线
    [self.view addSubview:_tabView];

    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_huiKStr intValue];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"Cell";
    HuiCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil)
    {
        cell = [[HuiCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    if ([cell isKindOfClass:[HuiCell class]])
    {
        if (_hiuArr.count != 0)
        {
            NSDictionary *dict = [_hiuArr objectAtIndex:indexPath.row];
            
            [(HuiCell *)cell setUpHuiMoneyCellWithName:dict[@"rengou_name"] withYueTime:dict[@"sign_time"] withYUeHouse:dict[@"fy_name"] withDaiState:dict[@"loan_type"] withDaiMoney:dict[@"loan_money"] withPhone:dict[@"rengou_phone"] withTypeString:dict[@"anjie_name"]];
            
        }
    }
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    QianYueDeatialsVC *qianYuwXVC = [[QianYueDeatialsVC alloc] init];
    qianYuwXVC.IDStr = [ [_hiuArr objectAtIndex:indexPath.row] objectForKey:@"id"];
    
    [self.navigationController pushViewController:qianYuwXVC animated:NO];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
